package com.dart.sys.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.dart.commons.base.web.BaseController;
import com.dart.framework.annotations.Log;
import com.dart.sys.entity.SysExLog;
import com.dart.sys.service.SysExLogService;
import com.github.pagehelper.PageInfo;

@RestController
@RequestMapping("/sys/exlog")
public class SysExLogController extends BaseController {
	
	@Autowired
	private SysExLogService service ;
	
	@Log("删除异常日志")
	@RequestMapping(value="/delete/{id}", method=RequestMethod.GET)
	public Object delete(@PathVariable Integer id) {
		Integer ret = this.service.deleteLog(id) ;
		if(ret > 0) {
			return setAjaxMapSuccess();
		} else {
			return setAjaxMapFailed();
		}
	}
	
	@Log("根据ID查询异常日志")
	@RequestMapping(value="/get/{id}", method=RequestMethod.GET)
	public Object get(@PathVariable Integer id) {
		return this.service.selectLogById(id) ;
	}
	
	@Log("查询异常日志")
	@RequestMapping(value="/list", method=RequestMethod.GET)
	public Object list(SysExLog entity) {
		PageInfo<SysExLog> selectPage = this.service.selectPageLog(entity) ;
		if(null != selectPage) {
			return setAjaxMapSuccess(selectPage) ;
		} else {
			return setAjaxMapFailed();
		}
	}
}
